package com.dh.jarvis;

import android.app.Application;

import com.dh.jarvis.Util.ImageUtil;
import com.dh.jarvis.Util.LogUtil;
import com.orm.SugarContext;

/**
 * Created by M.c on 2015/12/26.
 */
public class J {

    private J() {
    }

    public static class Ext {
        private static Application app;
        public static boolean isDebug = true;

        public Ext() {
        }
    }

    /**
     * 框架名称版本
     */
    public static String FRAMEWORK_NAME = "Jarvis1";

    public static Application app() {
        if (Ext.app == null) {
            LogUtil.e("please invoke j.Ext.init(app) on Application#onCreate()");
            return null;
        }
        return Ext.app;
    }

    /**
     * 调用框架初始化
     *
     * @param app 程序实例
     */
    public static void init(Application app) {
        if (Ext.app == null) {
            Ext.app = app;
        }
        SugarContext.init(app);//数据库ORM初始化
        ImageUtil.init(app);//image loader初始化
    }

    public static void setDebug(boolean debug) {
        Ext.isDebug = debug;
    }

    public static boolean getDebug() {
        return Ext.isDebug;
    }


}
